#define _CRT_SECURE_NO_WARNINGS 
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
//struct stu {
//	char name[20];
//	int age;
//};
//int main()
//{   
//	struct stu s = { "zhangsan",18};
//	printf("%s %d\n", s.name, s.age);
//	return 0;
//}
//struct stu{
//	char name[20];
//	int age;
//};
//void print(struct stu* s)
//{
//	printf("%s %d\n", s->name, s->age);
//}
//int main()
//{    
//	struct stu s = { "zhangsan",18 };
//	print(&s);
//	return 0;
//}
struct stu {
	char name[20];
	int age;
};
int com_name(const void* p1, const void* p2)
{
	return strcmp(((struct stu*)p1)->name, ((struct stu*)p2)->name);
}
int com_age(const void* p1, const void* p2)
{
	return (((struct stu*)p1)->age - ((struct stu*)p2)->age);
}
int main()
{   
	struct stu arr[3] = { {"zhangsan",18},{"lisi",15},{"wangwu",35} };
	int sz = sizeof(arr) / sizeof(arr[0]);
//	qsort(arr, sz, sizeof(arr[0]), com_name);
	qsort(arr, sz, sizeof(arr[0]), com_age);
	return 0;
}